﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Dreamz
{
    public class Rum8
    { 
        static public void Apply()
        {
            GameEngine.S.World[1, 3].OnLeave += new Room.OnLeaveHandler(NoLeave); // Metod som visar vad som sker när man lämnar 8:ans rums för att bege sig söderut
            GameEngine.GameState.IsMonsterDead = false;  // Monster/kanin tillståndet, ifall den är död/lever
        }
        static void NoLeave(Direction direction)   // Metod som visar vad som händer vid rum 8
        {
            string readline;
            if (direction == Direction.South && GameEngine.GameState.IsMonsterDead == false)   // ifall man trycker south så dyker error message upp, monsterns tillstånd
            {
                GameEngine.S.Player.X = 1;
                GameEngine.S.Player.Y = 3; 
                UI.Console.Clear();
                UI.Console.WriteLine("You hear growls, intercepted by odd squeals, coming through that door.\nWaiting outside, you hear the occasional grunt and what sounds like gnawing.\nSuddenly, you hear a ripping sound, followed by an agonized scream, and a wet thump.\nLater, only the sound of pouring liquid can be heard.\nYou aren't really sure, but maybe entering might be a bad idea?\nGo south to continue south or anything else to leave.");
                UI.Draw();
                readline = Console.ReadLine();


                if (readline == "south" || readline == "s" || readline == "go south") // ifall man trycker south igen så dör man
                {
                   //This gives the sad news that your character have died, and resets the game.
                    UI.Console.Clear();
                    UI.Console.Write("[GAME OVER]", ConsoleColor.Red);
                    UI.Console.WriteLine("As soon as you enter the room, you realize that you've made a mistake.\nYou see a horridly fluffy bunny fly towards you through the air,\nand the sensation as its teeth sink into your throat could be described as nice,\nby a damn liar. As the world goes black around you,\nyou realize that everything you've done this far, was in vain.");
                    UI.Draw();
                    Console.ReadKey();
                    Console.Clear();
                    GameEngine.S.Menu();
                }
               /* else
                {
                    GameEngine.S.Player.X = 1;      
                    GameEngine.S.Player.Y = 3;   
                }*/
            }
        }   
    }
}
